#ifndef MYSERIALPORT_H
#define MYSERIALPORT_H

#include <QWidget>
#include <QtSerialPort>
#include <QString>
#include <QSerialPortInfo>
#include <QMessageBox>
#include <QTimer>
#include <QPainter>

QT_BEGIN_NAMESPACE
namespace Ui { class MySerialport; }
QT_END_NAMESPACE

class MySerialport : public QWidget
{
    Q_OBJECT

public:
    MySerialport(QWidget *parent = nullptr);
    ~MySerialport();

    QSerialPort *serialPort;

private slots:
    void on_openBt_clicked();

    void on_clearBt_clicked();

    void on_btnSerialCheck_clicked();

    void on_sendBt_clicked();

    void on_btnClearSend_clicked();


    /*手动连接槽函数*/
    void manual_serialPortReadyRead();

    void on_chkTimSend_stateChanged(int arg1);

private:
    Ui::MySerialport *ui;

    long sendNum,recvNum;

    QLabel *lblSendNum;
    QLabel *lblRecvNum;
    QLabel *lblPortState;

    void setNumOnLabel(QLabel *lbl,QString strS,long num);

    QTimer *timSend;
};
#endif // MYSERIALPORT_H
